home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0163_Hardware Scrolling Routines.pas < prev    next >
Pascal/Delphi Source File  |  1995-03-03  |  981b  |  65 lines

  1. { Someone asked for the routines for hardware scrolling. So here it is: }
  2.  
  3. procedure setaddress(ad:word); assembler;
  4. asm
  5.   mov dx,3d4h
  6.   mov al,0ch
  7.   mov ah,[byte(ad)+1]
  8.   out dx,ax
  9.   mov al,0dh
  10.   mov ah,[byte(ad)]
  11.   out dx,ax
  12. end;
  13.  
  14. procedure setlinecomp(ad:word); assembler;
  15. asm
  16.   mov dx,3d4h
  17.   mov al,18h
  18.   mov ah,[byte(ad)]
  19.   out dx,ax
  20.   mov al,7
  21.   out dx,al
  22.   inc dx
  23.   in al,dx
  24.   dec dx
  25.   mov ah,[byte(ad)+1]
  26.   and ah,00000001b
  27.   shl ah,4
  28.   and al,11101111b
  29.   or al,ah
  30.   mov ah,al
  31.   mov al,7
  32.   out dx,ax
  33.   mov al,9
  34.   out dx,al
  35.   inc dx
  36.   in al,dx
  37.   dec dx
  38.   mov ah,[byte(ad)+1]
  39.   and ah,00000010b
  40.   shl ah,5
  41.   and al,10111111b
  42.   or al,ah
  43.   mov ah,al
  44.   mov al,9
  45.   out dx,ax
  46. end;
  47.  
  48. procedure retrace; assembler;
  49. asm
  50.   mov dx,3dah
  51.  @vert1:
  52.   in al,dx
  53.   test al,8
  54.   jz @vert1
  55.  @vert2:
  56.   in al,dx
  57.   test al,8
  58.   jnz @vert2
  59. end;
  60.  
  61. {
  62. There you go. Should also work in non-modex modes. Don't forget to include a
  63. retrace.
  64. }
  65.